﻿using Client.Constant;
using Client.Framework.Message;
using Client.Model;
using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Client.Message.Response
{
    [MessageAttr(MessageId.RESPONSE_TOP_MENUS)]
    class TopMenusResp : ResponseBaseMessage
    {

        public List<MainMenu> MainMenus { get; private set; } = new List<MainMenu>();

        public override void Deserialize(byte[] buffer)
        {
            ResponseTopMenus msg = ResponseTopMenus.Parser.ParseFrom(buffer);
            foreach (var menu in msg.Menus)
            {
                MainMenu mainMenu = new MainMenu
                {
                    ID = menu.Id,
                    Icon = menu.Icon,
                    Name = menu.MenuName
                };
                MainMenus.Add(mainMenu);
            }
        }
    }
}
